"use strict";

(function () {
    var template = function template(self) {
        return "\n<aux-view class=\"aux-button\">\n    <aux-view class=\"btn\">" + self.innerHTML + "</aux-view>\n    <aux-view class=\"mask\"></aux-view>\n</aux-view>\n        ";
    };

    function handleDisabled(self, newval, oldval) {
        if (newval && newval != null) {
            if (!self.$locked) {
                self.$locked = true;
            }
        } else {
            if (self.$locked) {
                self.$locked = false;
            }
        }
    }

    document.auiDefineElement("aux-button", {
        template: template,
        props: {
            "disabled": {
                afterCreated: function afterCreated(self, newval) {
                    handleDisabled(self, newval);
                },
                observer: function observer(self, oldval, newval) {
                    handleDisabled(self, newval);
                }
            }
        },
        attached: function attached(self) {
            self.$locked = false;
            self.$type = self.auiGetAttribute("form-type", "button");
        }
    });
})();